package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.product.client.ProductFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @Description:
 * @author: JC
 * @date: 2021/10/29 20:38
 */

@Controller
public class IndexController {

    @Autowired
    private ProductFeignClient productFeignClient;

    @GetMapping({"/","index.html"})
    public String index(ModelMap modelMap){
        // 获取首页分类数据
        Result result = productFeignClient.getBaseCategoryList();
        modelMap.addAttribute("list",result.getData());
        return "index/index";
    }

}
